package com.yhxd.modular.institutions.entity;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 机构
 */
@Data
@Entity(name = "ins_dept")
@EntityListeners(value = AuditingEntityListener.class)
public class Dept implements Serializable {

    @ApiModelProperty(value = "id")
    @Id
    @GeneratedValue(generator = "idGenerator")
    @GenericGenerator(name = "idGenerator", strategy = "com.yhxd.utils.IdUtils")
    @Column(name = "id")
    private Long id;

    @ApiModelProperty(value = "机构名称")
    @Column(name = "dept_name")
    private String depName;

    @ApiModelProperty(value = "是否外部机构，0否,1是")
    @Column(name = "external")
    private Integer external;

    @ApiModelProperty(value = "机构类型")
    @Column(name = "dep_type")
    private String depType;

    @ApiModelProperty(value = "是否主管单位，0否,1是")
    @Column(name = "manager_dep")
    private Integer managerDep;

    @ApiModelProperty(value = "父机构id")
    @Column(name = "pid")
    private Long pid;

    @ApiModelProperty(value = "父机构名称")
    @Column(name = "pname")
    private String pname;

    @ApiModelProperty(value = "排序")
    @Column(name = "sort")
    private Integer sort;

    @ApiModelProperty(value = "负责人")
    @Column(name = "resp_name")
    private String respName;

    @ApiModelProperty(value = "负责人电话")
    @Column(name = "resp_phone")
    private String respPhone;

    @ApiModelProperty(value = "联系人")
    @Column(name = "link_name")
    private String linkName;

    @ApiModelProperty(value = "联系人电话")
    @Column(name = "link_phone")
    private String linkPhone;

    @ApiModelProperty(value = "邮编")
    @Column(name = "zipcode")
    private String zipcode;

    @ApiModelProperty(value = "单位地址")
    @Column(name = "address")
    private String address;

    @ApiModelProperty(value = "创建人")
    @Column(name = "create_name")
    private String createName;

    @ApiModelProperty(value = "创建时间")
    @Temporal(TemporalType.TIMESTAMP)
    @CreatedDate
    @Column(name = "create_time")
    private Date createTime;

    @ApiModelProperty(value = "修改人")
    @Column(name = "update_name")
    private String updateName;

    @ApiModelProperty(value = "修改时间")
    @Temporal(TemporalType.TIMESTAMP)
    @LastModifiedDate
    @Column(name = "update_time")
    private Date updateTime;

    @ApiModelProperty(value = "数据是否可用，0不可用，1可用")
    @Column(name = "enable")
    private Integer enable = 1;

    @ApiModelProperty(value = "版本号")
    @Column(name = "version")
    private Integer version;
}
